Macromedia Flex Article

A Step-by-Step Guide to Building an Application with Flex


Table of Contents

  1. Introduction
  2. Flex Store
  3. Code Walkthrough
  4. MXML Components
  5. ActionScript Components
  6. Writing Code

ActionScript Components

Open ShoppingCart.as on your server and view the code in your text editor (ShoppingCart.as is part of the flexstore.zip, available in the Requirements section).

Shopping cart is a model class created in ActionScript. ActionScript 2.0 is a strongly typed, object oriented language and with a few syntactical differences, looks very much like a Java or C# class. Since ShoppingCart has no user interface, you use ActionScript so you have the programmatic control you need to create the model. The ShoppingCart model defines the functions you need to track what items are in the cart, how many there are and the total price for the items.

Cascading Style Sheets

The main.css file sets the font and colors for the application. Flex allows you to use standard cascading style sheets so that you can change styles in your application without touching the code.

Managers

Flex contains a series of managers as part of its application model. With the managers, you can easily implement commonly used functionality in MXML and ActionScript. For example, Flex contains a history manager that allows you to control application behavior in relation to browser back and forward button events. It also includes a Drag and Drop Manager that allows you to easily add that capability to your application (see CartView_script.as). With the ToolTip Manager, you can create tooltips for any visual component by setting a single attribute.